import type { ProTableOption } from "@/components/ProComponents/ProTable/index.vue";

export function buidCode(tableOptions: ProTableOption[], tableProps: Record<string, any>) {
    let buildPropsStr = '';

    Object.keys(tableProps).forEach(item => {
        buildPropsStr += ` :${item}="${tableProps[item]}"`
    })

    return `
<script lang="tsx" setup>
const options = computed(${JSON.stringify(tableOptions)});

function request() {
    return {
        total: 0,
        list: []
    }
}
</script>

<template>
    <ProTable :options :request ${buildPropsStr}/>
</template>
`
}